Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Oct 13, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 13, 2025 17:03
@github-actions
Copy link

Copyright Validation Results
Total: 3 | Passed: 3 | Failed: 0 | Skipped: 0 | at: 2025-10-13 17:03:40 UTC | commit: a1a29c5

✅ Valid Files

  • marklogic-spark-connector/src/main/java/com/marklogic/spark/reader/JsonRowDeserializer.java
  • marklogic-spark-connector/src/main/java/com/marklogic/spark/reader/file/FileUtil.java
  • marklogic-spark-connector/src/test/java/com/marklogic/spark/reader/file/MakeFilePartitionsTest.java

✅ All files have valid copyright headers!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies several fixes to improve the Polaris functionality in the MarkLogic Spark connector. The changes focus on defensive programming practices and edge case handling.

  • Added divide-by-zero protection for file partition creation
  • Enhanced JSON deserialization with null safety checks
  • Added test coverage for zero partition edge cases

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
FileUtil.java Added validation to prevent divide-by-zero when numPartitions is <= 0
JsonRowDeserializer.java Added null safety check for JSON parsing results
MakeFilePartitionsTest.java Added test case to verify zero partition handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

public InternalRow deserializeJson(String json) {
return this.jacksonParser.parse(json, this.jsonParserCreator, this.utf8StringCreator).head();
var parsedResult = this.jacksonParser.parse(json, this.jsonParserCreator, this.utf8StringCreator);
Objects.requireNonNull(parsedResult, "The output from parsing the JSON should never be null");
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message should be more specific about what happens when null is encountered and provide actionable information for debugging, such as 'Failed to parse JSON input - received null result from JacksonParser'.

Suggested change
Objects.requireNonNull(parsedResult, "The output from parsing the JSON should never be null");
Objects.requireNonNull(parsedResult,
"Failed to parse JSON input - received null result from JacksonParser. " +
"Input (truncated to 100 chars): " +
(json == null ? "null" : json.substring(0, Math.min(json.length(), 100)))
);

Copilot uses AI. Check for mistakes.
@sonarqube-progress-marklogic
Copy link

@rjrudin rjrudin merged commit d213dee into develop Oct 13, 2025
3 of 4 checks passed
@rjrudin rjrudin deleted the feature/polaris-fixes branch October 22, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants